/*
 * @Author: 肖思汗 
 * @Date: 2019-08-18 13:27:09 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2021-12-26 21:16:21
 */

import loadable from "@loadable/component";
import Dev from "@pages/Dev/Dev";
import ReactMixinComponent from "@ReactMixinComponent";
import React from "react";
import { Route, Router, Switch } from "react-router-dom";

// 主页
import Home from "@pages/home/Home";

// 异常页面
const Error404 = loadable(() => import("@pages/404/Error404"));

const XshReactThreeDemo = loadable(() => import("@pages/XshReactThreeDemo/XshReactThreeDemo"));

const Canvas = loadable(() => import("@pages/Canvas/Canvas"));

// 布局
const Layout = loadable(() => import("@pages/layout/Layout"));

// 着色器笔记
const ShaderNotes = loadable(() => import("@pages/ShaderNotes/ShaderNotes"));

interface Props {
}

interface State {
}

export default class Routers extends ReactMixinComponent<Props, State> {
    constructor(props: Props) {
        super(props);
    }

    render() {
        return (
            <Layout>
                <Router history={this.mixin_history}>
                    <Switch>
                        <Route exact path={["/", "/home"]} component={Home} />
                        <Route exact path="/xsh_react_three_demo" component={XshReactThreeDemo} />
                        <Route exact path="/xsh_react_three_demo/:path" component={XshReactThreeDemo} />
                        <Route exact path="/dev" component={Dev} />
                        <Route exact path="/canvas" component={Canvas} />
                        <Route exact path="/shaderNotes" component={ShaderNotes} />
                        <Route path="*" component={Error404} />
                    </Switch>
                </Router>
            </Layout>
        );
    }
}